package com.pet.serve.repository;

import com.pet.serve.entity.Schedule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Date;
import java.util.List;

@Repository
public interface ScheduleRepository extends JpaRepository<Schedule, Long> {

    // Find schedules by username with pagination support
    List<Schedule> findByUsername(String username);

    // Find schedules by a specific date
    List<Schedule> findByDay(Date day);

    // Find schedules created within a date range
    List<Schedule> findByDayBetween(Date startDate, Date endDate);

    // Delete schedules by username
    void deleteByUsername(String username);

    // Delete multiple schedules by IDs
    void deleteByScheduleidIn(List<Long> scheduleIds);

    // 使用 Pageable 自动处理分页
    Page<Schedule> findAll(Pageable pageable);
}
